<template>
    <div>
        <MymHeader></MymHeader>
        <van-panel title="用户信息" desc="用户信息设置" :status="$store.state.currentLoginUserInfo?$store.state.currentLoginUserInfo.username.substr(0,6):'求真像'" @click="undederConstructor">

        </van-panel>
        <van-panel title="我的收藏" desc="收藏的精彩博文" @click="undederConstructor">

        </van-panel>
        <van-panel title="我的课程" desc="正在学习的课程" @click="undederConstructor">

        </van-panel>
        <van-panel>
            <van-button type="default" block @click="doLogout">注销</van-button>
        </van-panel>
        <MymNavBar></MymNavBar>
    </div>
</template>

<script>
    import MymNavBar from "@/components/mobile/MymNavBar";
    import MymHeader from "@/components/mobile/MymHeader";
    import request from "@/util/request";

    export default {
        name: "MymUserCenter",
        components: {
            MymNavBar,
            MymHeader
        },
        created() {
            //判断当前用户是否登录
            if (!this.$store.state.currentLoginStatusData) {
                //说明没有登录
                this.$router.replace('/mLogin');
            }
        },
        mounted() {

        },
        methods: {
            undederConstructor(){
                //console.log('显示详情....');
                this.$toast('开发中敬请期待...')
            },

            //用户注销
            doLogout(){
                this.$store.dispatch("Logout").then(resp => {
                    if (resp.data.code === 200) {
                        this.$toast.success('注销成功');
                        setTimeout("javascript:window.location.href='/mLogin'", 2000);
                    }
                }).catch(err => {
                    console.log(err);
                })
            }
        }

    }
</script>

<style scoped>

</style>